/*
 * DisplayLocum.fx
 *
 * Created on 2009-09-08, 15:58:11
 */

package shmallarchitect.gui;

import javafx.scene.CustomNode;
import javafx.scene.Group;
import javafx.scene.Node;

import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.transform.Translate;

import javafx.scene.text.Font;
import javafx.scene.text.Text;

import javafx.scene.control.Button;

import javafx.scene.image.Image;
import javafx.scene.image.ImageView;

import shmallarchitect.java.Locuma;


/**
 * @author Administrator
 */

public var displayed:Integer;
public var view_mode:Boolean = false;

public var displayedLocum:Locuma;
public var resourcelist_: Integer[] = bind displayedLocum.getResource();



var color: Group = Group {

        content: [
               Rectangle { width: 40 height: 40
                            fill: bind BaseLayout.local_list[displayed].locumcolor;
                            stroke: Color.web("#555555")
                            strokeWidth: 3
                          },
                          
              Text {x: 50 y: 24;
              content: bind "Locum ID: {BaseLayout.local_list[displayed].locumid}"
              font: Font.font("Verdana", 14);
              fill: Color.web("#ffffff")
                }


                 ]

                 transforms: [ Translate {x: 0 y: 40 }]

}

var labels: Group = Group {

content: [

        Text {x: 5 y: 0;
              content: bind "Locum Name: {BaseLayout.local_list[displayed].name}"
              font: Font.font("Verdana", 12);
              fill: Color.web("#ffffff")
             },

        Text {x: 5 y: 30;
              content: bind "Locum Description: {BaseLayout.local_list[displayed].textual_desc}"
              font: Font.font("Verdana", 12);
              fill: Color.web("#ffffff")
             },

        Text {x: 5 y: 60;
              content: bind "Locum WWW: {BaseLayout.local_list[displayed].www}"
              font: Font.font("Verdana", 12);
              fill: Color.web("#ffffff")
             },

        Text {x: 5 y: 90;
              content: bind "Locum Phone: {BaseLayout.local_list[displayed].phone}"
              font: Font.font("Verdana", 12);
              fill: Color.web("#ffffff")
             },
             
]

                 transforms: [ Translate {x: 0 y: 100 }]
}

var back: Button = Button {

           text: "Back to Gallery"
           action: function() {

           BaseLayout.mode = true;
           view_mode = false;

            }

            visible: bind view_mode ;
            transforms: [ Translate {x: 90, y: 600 } ]
}

/*
public var iurl1:String = bind BaseLayout.resource_list[resourcelist_[1]].getUrl();
public var iurl2:String = bind BaseLayout.resource_list[resourcelist_[1]].getUrl();
public var iurl3:String = bind BaseLayout.resource_list[resourcelist_[2]].getUrl();
*/

public var imgurl1:String = bind BaseLayout.resource_list[resourcelist_[0]].getUrl();// = bind BaseLayout.resource_list[resourcelist_[0]].getUrl();
public var imgurl2:String = bind BaseLayout.resource_list[resourcelist_[1]].getUrl();// = bind BaseLayout.resource_list[resourcelist_[1]].getUrl();
public var imgurl3:String = bind BaseLayout.resource_list[resourcelist_[2]].getUrl();// = bind BaseLayout.resource_list[resourcelist_[2]].getUrl();


function display_resource() {


var i1 = bind Image {
                   url: imgurl1;
                   preserveRatio: true
                  }

var i2 = bind Image {
                   url: imgurl2;
                   preserveRatio: true
                  }

var i3 = bind Image {
                   url: imgurl3;
                   preserveRatio: true
                  }

var iView1 = ImageView {          image: bind i1;
                                    fitWidth: bind ResourceUtil.resize_width(i1, 450)
                                    fitHeight: bind ResourceUtil.resize_height(i1, 200)
                                    preserveRatio: true
                                    smooth: true
                                    cache: true

                                    x: 500
                                    y: 0

                                 }

var iView2 = ImageView {          image: bind i2;
                                    fitWidth: bind ResourceUtil.resize_width(i2, 450)
                                    fitHeight: bind ResourceUtil.resize_height(i2, 200)
                                    preserveRatio: true
                                    smooth: true
                                    cache: true

                                    x: 500
                                    y: 220

                                 }


var iView3 = ImageView {          image: bind i3;
                                    fitWidth: bind ResourceUtil.resize_width(i3, 450)
                                    fitHeight: bind ResourceUtil.resize_height(i3, 200)
                                    preserveRatio: true
                                    smooth: true
                                    cache: true

                                    x: 500
                                    y: 440

                                 }

  return Group {
                  content: [

                         iView1, iView2, iView3
                 ]

                 visible: true;
                 transforms: [ Translate {x: 0, y: 40 } ]
                 };

}




 public class DisplayLocum extends CustomNode {

         public override function create(): Node {
                 return Group {
                         content: [ color, labels, back, OwnerUtil.displayOwner(10, 250),
                                    display_resource(),
                                    ]

                          visible: bind view_mode;
                          transforms: [ Translate {x: 15 y: 0 }]
                 };

         }
 }

